import {createStore} from "redux";

const defaultState={value: 0,message: ''}
function reducer(state= defaultState,action) {
  const {type} = action;
  switch (type) {
    case 'ADD':
      return {...state, value:state.value+1};
    case 'SUB':
      return {...state, value: state.value-1};
    case 'SAY':
      return {...state, message: state.message+' speak to me' };
    default:
      return state;
  }
}
const store = createStore(reducer)

export default store

